package com.agricultural.command.impl;

import com.agricultural.command.Command;
import com.agricultural.equipment.AgriculturalEquipment;

// 停止命令
public class StopCommand implements Command {
    private AgriculturalEquipment equipment; // 设备引用
    
    // 构造函数
    public StopCommand(AgriculturalEquipment equipment) {
        this.equipment = equipment;
    }
    
    // 执行命令
    @Override
    public void execute() {
        System.out.println("执行停止命令: " + equipment.getType() + "-" + equipment.getId());
        equipment.stop();
    }
    
    // 撤销命令
    @Override
    public void undo() {
        System.out.println("撤销停止命令: " + equipment.getType() + "-" + equipment.getId());
        equipment.start();
    }
}    